package com.wlz.consumer;

import com.wlz.framework.ProxyFactory;
import com.wlz.provider.api.HelloService;
import lombok.extern.slf4j.Slf4j;

/**
 *  服务消费者
 * @author wlz
 * @date 2022-07-11  9:21 下午
 */
@Slf4j
public class Consumer {

    public static void main(String[] args) {

        // 1. 最初 实现
//        HttpClient httpClient = new HttpClient();
//        Invocation invocation = new Invocation(HelloService.class.getName(), "sayHello",
//                new Class[]{String.class}, new Object[]{"wlz调用"});
//        String result = httpClient.send("localhost", 8080, invocation);
//        log.info(" result is : {} ", result);

        // 2. 改进
        HelloService helloService = ProxyFactory.getProxy(HelloService.class);
        String result = helloService.sayHello("wlzzzzzz");
        log.info(" result is : {} ", result);


    }
}
